package com.phiture.erp.produce.core.convert;

import com.phiture.erp.produce.core.pojo.dto.MrpBomInfoDTO;
import com.phiture.erp.produce.dal.entity.ErpBomItemsDO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import java.util.List;

@Mapper
public interface ErpBomConvertMapper {
    ErpBomConvertMapper INSTANCE = Mappers.getMapper(ErpBomConvertMapper.class);

    @Mappings({
            @Mapping(target = "id", source = "fid"),
            @Mapping(target = "seq", source = "fseq"),
            @Mapping(target = "processId", source = "fprocess"),
            @Mapping(target = "consumeFixQty", source = "fconsumefixqty"),
            @Mapping(target = "materialId", source = "fmaterialid"),
            @Mapping(target = "materialAttr", source = "fmaterialprop"),
            @Mapping(target = "remark", source = "fremark"),
            @Mapping(target = "parentId", source = "fparentid"),
            @Mapping(target = "leadTime", source = "fleadtime"),
            @Mapping(target = "effectiveDate", source = "feffectivedate"),
            @Mapping(target = "disableDate", source = "fdisabledate"),
            @Mapping(target = "issMode", source = "fissmode"),
            @Mapping(target = "defaultWarehouseId", source = "fdefaultwarehouseid"),
            @Mapping(target = "backFlushFlag", source = "fisbackflush"),
            @Mapping(target = "materialBarCode", ignore = true),
            @Mapping(target = "materialName", ignore = true),
            @Mapping(target = "materialUnitName", ignore = true),
            @Mapping(target = "materialStandard", ignore = true),
            @Mapping(target = "produceLeadTime", ignore = true),
            @Mapping(target = "recevingLeadTime", ignore = true),
    })
    MrpBomInfoDTO toBomInfoDTO(ErpBomItemsDO bomItemsDO);
    List<MrpBomInfoDTO> toBomInfoDTOList(List<ErpBomItemsDO> bomItemsDOList);
}
